]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
grabHelper: Remove explicitly having to select modal
authorJasper St. Pierre <jstpierre@mecheye.net>
Thu, 23 May 2013 21:20:30 +0000 (17:20 -0400)
committerJasper St. Pierre <jstpierre@mecheye.net>
Mon, 8 Jul 2013 20:51:51 +0000 (16:51 -0400)
https://bugzilla.gnome.org/show_bug.cgi?id=700735

js/ui/grabHelper.js
js/ui/messageTray.js
js/ui/popupMenu.js

index d69a5345e0b22f8924ce6f0f6e56be09d8fd105e..296ce46f79fde8bf4637bbb014126b5efdf8a439 100644 (file)
@@ -144,7 +144,6 @@ const GrabHelper = new Lang.Class({
     // focus on the clicked on menu item.
     grab: function(params) {
         params = Params.parse(params, { actor: null,
-                                        modal: false,
                                         focus: null,
                                         onUngrab: null });
 
@@ -157,7 +156,7 @@ const GrabHelper = new Lang.Class({
 
         params.savedFocus = focus;
 
-        if (params.modal && !this._takeModalGrab())
+        if (!this._takeModalGrab())
             return false;
 
         this._grabStack.push(params);
@@ -169,9 +168,6 @@ const GrabHelper = new Lang.Class({
                 newFocus.grab_key_focus();
         }
 
-        if (params.modal && !this._capturedEventId)
-            this._capturedEventId = global.stage.connect('captured-event', Lang.bind(this, this._onCapturedEvent));
-
         return true;
     },
 
@@ -180,6 +176,8 @@ const GrabHelper = new Lang.Class({
         if (firstGrab) {
             if (!Main.pushModal(this._owner, this._modalParams))
                 return false;
+
+            this._capturedEventId = global.stage.connect('captured-event', Lang.bind(this, this._onCapturedEvent));
         }
 
         this._modalCount++;
@@ -191,6 +189,11 @@ const GrabHelper = new Lang.Class({
         if (this._modalCount > 0)
             return;
 
+        global.stage.disconnect(this._capturedEventId);
+        this._capturedEventId = 0;
+
+        this._ignoreRelease = false;
+
         Main.popModal(this._owner);
         global.sync_pointer();
     },
@@ -238,15 +241,7 @@ const GrabHelper = new Lang.Class({
             if (poppedGrab.onUngrab)
                 poppedGrab.onUngrab(params.isUser);
 
-            if (poppedGrab.modal)
-                this._releaseModalGrab();
-        }
-
-        if (!this.grabbed && this._capturedEventId > 0) {
-            global.stage.disconnect(this._capturedEventId);
-            this._capturedEventId = 0;
-
-            this._ignoreRelease = false;
+            this._releaseModalGrab();
         }
 
         if (hadFocus) {
index 3bd15c3d10aa717081815e13c023492ce9155945..4cb1bd6ec97b4bad73f0808360c37d5df3df7159 100644 (file)
@@ -1808,7 +1808,6 @@ const MessageTray = new Lang.Class({
         let [x, y, mask] = global.get_pointer();
         this._contextMenu.setPosition(Math.round(x), Math.round(y));
         this._grabHelper.grab({ actor: this._contextMenu.actor,
-                                modal: true,
                                 onUngrab: Lang.bind(this, function () {
                                     this._contextMenu.close(BoxPointer.PopupAnimation.FULL);
                                 })
@@ -2375,7 +2374,6 @@ const MessageTray = new Lang.Class({
 
     _showTray: function() {
         if (!this._grabHelper.grab({ actor: this.actor,
-                                     modal: true,
                                      onUngrab: Lang.bind(this, this._escapeTray) })) {
             this._traySummoned = false;
             return false;
@@ -2720,7 +2718,6 @@ const MessageTray = new Lang.Class({
 
         this._summaryBoxPointer.bin.child = child;
         this._grabHelper.grab({ actor: this._summaryBoxPointer.bin.child,
-                                modal: true,
                                 onUngrab: Lang.bind(this, this._onSummaryBoxPointerUngrabbed) });
 
         this._summaryBoxPointer.actor.opacity = 0;
index 28d1d26b7d5cad1c3b372b7c7b6b829970e851af..4b9eb400817d69993b8e1ef6b5c8bd7f4b5cbde3 100644 (file)
@@ -1701,7 +1701,7 @@ const PopupMenuManager = new Lang.Class({
         if (open) {
             if (this.activeMenu && !this.activeMenu.isChildMenu(menu))
                 this.activeMenu.close(BoxPointer.PopupAnimation.FADE);
-            this._grabHelper.grab({ actor: menu.actor, modal: true, focus: menu.sourceActor,
+            this._grabHelper.grab({ actor: menu.actor, focus: menu.sourceActor,
                                     onUngrab: Lang.bind(this, this._closeMenu, menu) });
         } else {
             this._grabHelper.ungrab({ actor: menu.actor });